import java.io.Serializable;
import java.util.*;

public class ExchangeTable implements Serializable {
	private static final long serialVersionUID = 30L;
	
	private Integer code;
	private Date date;
	private Double exchangeRate;
	private Double exchangeBegin;
	private Double rateChange;
	
	ExchangeTable(Integer code){
		this.code= code;
		this.exchangeBegin=randomDouble();
  	  	updateData();
	}
	
	public void updateData(){
		this.date = new Date();
		//this.exchangeBegin=randomDouble();
		this.exchangeRate=randomDouble();
		this.rateChange=randomDouble();
	}

	double randomDouble(){
		double rnd = new Random().nextDouble();
		int temp = (int)(rnd * Math.pow(10, 2));  
		return ((double)temp)/Math.pow(10, 2);  
	}
	
	Integer getCode(){
		return this.code;
	}
	Date getDate(){
		return this.date;
	}
	Double getExchangeRate(){
		return this.exchangeRate;
	}
	Double getExchangeBegin(){
		return this.exchangeBegin;
	}
	Double getRateChange(){
		return this.rateChange;
	}
}